import java.util.Scanner;

public class Login {

    private String name="123q";

    private String passard="123456";

    public void func(String name,String passard){

        try{
            if(!this.name.equals(name)){
                throw new nameErrorException();
            }
            if(!this.passard.equals(passard)){

                throw new passardErrorException();
            }
            System.out.println("登陆成功！");

        }catch(nameErrorException e){
            e.printStackTrace();
            System.out.println("登陆失败！用户名输入错误！……");
        }catch(passardErrorException e){
            e.printStackTrace();
            System.out.println("登陆失败！用户密码输入错误！……");
        }



    }

    public static void main(String[] args) {


        Login l=new Login();

        Scanner cin=new Scanner(System.in);

        System.out.println("输入用户名：");
        String name=cin.next();

        System.out.println("输入用户密码：");
        String passard=cin.next();

        l.func(name,passard);

        System.out.println("继续……");

    }




}
